package com.alibaba.citrus.cr.sales.plan.contants;


/**
 * @author luyi
 * @date 2021/12/2 10:23 上午
 */
public class SalesPlanLockKey {

    /**
     * 月度计划汇总锁前缀
     */
    private static final String PLAN_STAT_LOCK_PREFIX = "plan_stat_";

    /**
     * 月度计划汇总锁前缀（带有更新销售负责人）
     */
    private static final String PLAN_STAT_WITH_UPDATE_PRINCIPAL_LOCK_PREFIX = "plan_stat_with_update_principal_";

    /**
     * 合同汇总锁前缀
     */
    private static final String CONTRACT_STAT_LOCK_PREFIX = "contract_stat_";

    /**
     * 月度计划生词部门任务量锁前缀
     */
    private static final String PLAN_PUBLISH_FOR_DEPARTMENT_LOCK_PREFIX = "plan_publish_department_";

    /**
     * 提报CRM锁前缀
     */
    private static final String PLAN_SUBMIT_TO_CRM_LOCK_PREFIX = "plan_submit_to_crm_";

    /**
     * 月度计划提交CRM回调锁前缀
     */
    public static final String PLAN_SUBMIT_TO_CRM_CALLBACK_PREFIX = "plan_submit_to_crm_callback_";

    /**
     * 生成客户任务量锁前缀
     */
    private static final String DISPATCH_PLAN_SC_ITEM_CUSTOMER_PREFIX = "dispatch_plan_sc_item_customer_";

    /**
     * 生成客户调整任务量锁前缀
     */
    private static final String DISPATCH_PLAN_SC_ITEM_ADJUST_PREFIX = "dispatch_plan_sc_item_adjust_";

    /**
     * 生成月度计划锁前缀
     */
    public static final String CREATE_SALES_PLAN_PREFIX = "create_sales_plan_";

    /**
     * 发布调整客户任务量
     */
    public static final String PUBLISH_PLAN_SC_ITEM_ADJUST_PREFIX = "publish_plan_sc_item_adjust_";

    /**
     * 编辑部门任务量（失焦保存）
     */
    public static final String EDIT_SALES_PLAN_DEPARTMENT_PUBLISH_PREFIX = "edit_sales_plan_department_publish_";

    /**
     * 发布部门任务量
     */
    public static final String PUBLISH_PLAN_SC_ITEM_DEPARTMENT_PREFIX = "publish_plan_sc_item_department_";

    /**
     * 重置部门任务量
     */
    public static final String RESET_PLAN_SC_ITEM_DEPARTMENT_PREFIX = "reset_plan_sc_item_department_";

    /**
     * 计划明细失焦保存
     */
    public static final String EDIT_SALES_PLAN_DETAIL_PREFIX = "edit_sales_plan_detail_";

    /**
     * 计划明细编辑import
     */
    public static final String EDIT_SALES_PLAN_DETAIL_IMPORT_PREFIX = "edit_sales_plan_detail_import_";

    /**
     * 月度计划提报
     */
    public static final String SALES_PLAN_REPORT_PREFIX = "sales_plan_report_";

    /**
     * 月度计划提报
     */
    public static final String BATCH_AUDIT_TASK_PREFIX = "batch_Audit_Task_";

    /**
     * 调整发送邮件
     */
    public static final String ADJUSTMENT_WRITE_EASY_EXCEL_FILE_PREFIX = "adjustment_write_easy_excel_file_";

    /**
     * 生成计划货品
     */
    public static final String CREATE_SALES_PLAN_SC_ITEM_PREFIX = "create_sales_plan_sc_item_";

    /**
     * 更新价格
     */
    public static final String BATCH_UPDATE_PLAN_SC_ITEM_PRICE_PREFIX = "batch_update_plan_sc_item_price_";

    /**
     * 部门、渠道提报量分解到明细
     */
    public static final String PLAN_MONTH_COUNT_DECOMPOSITION = "plan_month_count_decomposition_";

    /**
     * 部门、渠道调整量分解到明细
     */
    public static final String ADJUST_COUNT_DECOMPOSITION = "adjust_count_decomposition_";

    /**
     * 获取月度计划汇总锁 key
     * @param planId 计划ID
     * @return       lockKey
     */
    public static String getPlanStatLockKey(String planId){
        return PLAN_STAT_LOCK_PREFIX + planId;
    }

    /**
     * 月度计划生成部门任务量锁 key
     * @param planId 计划ID
     * @return       lockKey
     */
    public static String getPlanPublishDepartmentLockKey(String planId){
        return PLAN_PUBLISH_FOR_DEPARTMENT_LOCK_PREFIX + planId;
    }

    /**
     * 合同汇总锁
     * @param year 年分
     * @return
     */
    public static String getContractStatLockKey(String year){
        return CONTRACT_STAT_LOCK_PREFIX + year;
    }

    /**
     * 提报CRM锁 key
     * @param planId
     * @return
     */
    public static String getPlanSubmitToCRMLockKey(String planId){
        return PLAN_SUBMIT_TO_CRM_LOCK_PREFIX + planId;
    }

    /**
     * 生成客户回复量 key
     * @param planId
     * @return
     */
    public static String getDispatchPlanScItemForCustomerLockKey(String planId){
        return DISPATCH_PLAN_SC_ITEM_CUSTOMER_PREFIX + planId;
    }

    /**
     * 生成客户调整回复量 key
     * @param adjustId
     * @return
     */
    public static String getDispatchPlanScItemForAdjustLockKey(String adjustId){
        return DISPATCH_PLAN_SC_ITEM_ADJUST_PREFIX + adjustId;
    }

    /**
     * 部门、渠道提报量分解到明细 key
     * @param id
     * @param scItemId
     * @return
     */
    public static String getPlanMonthCountDecompositionLockKey(String id,String scItemId){
        return PLAN_MONTH_COUNT_DECOMPOSITION + id + scItemId;
    }

    /**
     * 部门、渠道调整量分解到明细 key
     * @param id
     * @param scItemId
     * @return
     */
    public static String getAdjustCountDecompositionLockKey(String id,String scItemId){
        return ADJUST_COUNT_DECOMPOSITION + id + scItemId;
    }

    /**
     * 获取月度计划汇总锁（带有更新销售负责人） key
     * @param planId 计划ID
     * @return       lockKey
     */
    public static String getPlanStatWithUpdatePrincipalLockKey(String planId){
        return PLAN_STAT_WITH_UPDATE_PRINCIPAL_LOCK_PREFIX + planId;
    }

}
